Skip to content

modularization#477

Open
evaleev wants to merge 8 commits intomasterfrom
evaleev/feature/target-reord
Open

modularization#477
evaleev wants to merge 8 commits intomasterfrom
evaleev/feature/target-reord

Conversation

@evaleev
Copy link
Member

@evaleev evaleev commented Feb 3, 2026

along the lines of #391, prompted by devious OpenMP compilation injection into TA breaking one of the tests. This includes not only logical reorganization into proto-C++-modules, but some physical layout adjustments to more cleanly separate symbolic core from eval from export. @Krzmbrzl have a peek.

Copilot description follows.

This pull request significantly restructures the CMake build system for the SeQuant project, introducing a modular, layered approach to library targets. The changes partition the codebase into logical components (symbolic, evaluation, export, MBPT domain, etc.), improve dependency management, and update installation and configuration logic accordingly. Additionally, some header inclusions and typos are fixed, and documentation is updated for clarity.

CMake build system modularization and improvements:

  • Refactored CMakeLists.txt to define separate CMake targets for each logical layer: SeQuant-symb (symbolic core), SeQuant-eval (evaluation framework), SeQuant-eval-ta (TiledArray backend), SeQuant-eval-btas (BTAS backend), SeQuant-export (export/codegen), SeQuant-core (version info, links symbolic+export), and SeQuant-mbpt (MBPT domain code). An umbrella SeQuant INTERFACE target is provided for backwards compatibility. [1] [2] [3] [4] [5] [6]
  • Updated installation logic to install all new targets and ensure all expected imported targets exist, with improved error messages in sequant-config.cmake.in.
  • Improved handling of include-what-you-use (IWYU) by applying it to all new targets, not just the monolithic one.

Code organization and header updates:

  • Moved optimization code from SeQuant/core/optimize.* to SeQuant/core/eval/optimize.* and updated all includes accordingly. [1] [2] [3] [4] [5]
  • Fixed a typo in documentation: changed aproximate_size() to approximate_size() in SeQuant/core/eval/optimize.hpp. [1] [2] [3]

Documentation:

  • Clarified operator label case in doc/user/guide/operator.rst ("T" or "Λ" → "t" or "λ").

this test would not compile because TA inherited compile OpenMP dependence from blaspp (?) .. and OpenMP is not quite C++.
…sumers (incl. SQ tests) on TA/BTAS ... and to model the module structure described MS1.
@evaleev evaleev requested a review from Copilot February 3, 2026 22:41
@evaleev evaleev linked an issue Feb 3, 2026 that may be closed by this pull request
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the SeQuant CMake build system from a monolithic structure to a modular, layered architecture. The changes partition the codebase into logical components (symbolic core, evaluation framework, export/codegen, MBPT domain, and backend-specific modules), improve dependency management, and update installation/configuration logic. Additionally, optimization code is relocated from SeQuant/core/optimize.* to SeQuant/core/eval/optimize.*, with all includes updated throughout the codebase, and several typos are corrected.

Changes:

  • Introduced modular CMake targets: SeQuant-symb, SeQuant-eval, SeQuant-eval-ta, SeQuant-eval-btas, SeQuant-export, SeQuant-core, and SeQuant-mbpt, with an umbrella SeQuant INTERFACE target for backwards compatibility
  • Reorganized optimization code from core/optimize to core/eval/optimize directory structure with corresponding header path updates across the entire codebase
  • Restructured unit tests into separate OBJECT libraries aligned with the new modular targets, improving build organization and compilation efficiency

Reviewed changes

Copilot reviewed 19 out of 21 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
CMakeLists.txt Defines new modular library targets with explicit source lists and dependencies; updates installation and IWYU configuration
cmake/sequant-config.cmake.in Updates target verification logic to check for all new modular targets
tests/unit/CMakeLists.txt Restructures tests into OBJECT libraries per module; maintains conditional backend compilation
utilities/external-interface/*.cpp Updates includes from core/optimize to core/eval/optimize
tests/unit/test_*.cpp Updates includes to reflect new header locations
tests/integration/eval/calc_info.hpp Updates include path for optimize header
SeQuant/core/eval/optimize/*.{hpp,cpp} Adds new header files for modularized optimization code
SeQuant/core/expressions/result_expr.cpp Removes unnecessary optimize.hpp include
SeQuant/domain/mbpt/spin.cpp Updates include path for optimize functionality
tests/unit/gwt.hpp Changes from structured binding to explicit reference extraction (compatibility/style)
doc/user/guide/operator.rst Clarifies operator label case convention
SeQuant/core/eval/optimize.hpp Corrects spelling: "aproximate_size()" → "approximate_size()"

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@evaleev evaleev added this to the 2.1 milestone Feb 3, 2026
Copy link
Collaborator

@Krzmbrzl Krzmbrzl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know that a lot of the "could be private" comments are not inherently new due to changes made in this PR but I feel like the strive for a more modularized setup makes these kinds of things much more important.

CMakeLists.txt Outdated
target_link_libraries(SeQuant INTERFACE SeQuant-eval-btas)
endif()
if (SEQUANT_EVAL_TRACE)
target_compile_definitions(SeQuant INTERFACE SEQUANT_EVAL_TRACE=1)
Copy link
Collaborator

@Krzmbrzl Krzmbrzl Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be defined on the eval module 👀

Catch2::Catch2
dtl::dtl
Boost::boost
Eigen3::Eigen)
Copy link
Collaborator

@Krzmbrzl Krzmbrzl Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe Eigen is only needed for the export validation tests, which aren't part of this object library.

Copy link
Collaborator

@Krzmbrzl Krzmbrzl Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dependency handling could be more scoped - currently it seems all dependencies are added to all module tests.

- introduced `optimize` module
- introduced sequant_add_library to cleanup module creation
- cleanup dependencies
@evaleev
Copy link
Member Author

evaleev commented Feb 5, 2026

@Krzmbrzl defining proper API boundaries is too much work for now, I've done a bit, but it feels like bikeshedding. Enough for now.

@evaleev evaleev force-pushed the evaleev/feature/target-reord branch from 51c66ac to e7cd9f0 Compare February 5, 2026 22:11
@evaleev evaleev force-pushed the evaleev/feature/target-reord branch from e7cd9f0 to 0992461 Compare February 6, 2026 03:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

split SeQuant targets

3 participants